//efform_onload = function ()
//{
//	var info = new EiInfo();
//	info.set("fdMineId",$('#fdMineId').val());
//	info.set("fdParentId",$('#fdParentId').val());
////	EiCommunicator.send("ZMCS02", "query", info, ajax_chang_callback);
//	efgrid.submitForm("ef_grid_result", "ZM", "ZMCS05","query", true);
//	//EiCommunicator.send("ZMCS05", "query", info, ajax_chang_callback2);
//}; 


button_insert_onclick = function () {
	if (isSelected("ef_grid_result") == 0)return; 
//	efgrid.submitForm( "ef_grid_result", "ZM","ZMCS05","insert",true);
	//以下为行增有重复性校验
	var info = getSCZXEiInfos("ZMCS05","ef_grid_result");
	if (null != info) { 
		EiCommunicator.send("ZMCS05", "validate", info, validate_callback);
	}
}
button_update_onclick = function() {
	if (isSelected("ef_grid_result") == 0)return; 
//	efgrid.submitForm( "ef_grid_result", "ZM","ZMCS05","update",true);
	//以下为行增有重复性校验
	var info = getSCZXEiInfos("ZMCS05","ef_grid_result");
	if (null != info) { 
		EiCommunicator.send("ZMCS05", "validate", info, validate_callback);
	}
}
button_delete_onclick = function (){ 
	if (isSelected("ef_grid_result") == 0)return; 
	EFConfirm('你确认要删除吗?', '确认框', function(r) {
		efgrid.submitForm( "ef_grid_result", "ZM","ZMCS05","delete",true);
	});
} 
var validate_callback={
		onSuccess:function(eiInfo){
			if(eiInfo.getStatus()==-1){
				EFAlert("操作失败，原因："+eiInfo.getMsg());
			}else{
/*				 efwindow.hide();
				 var grid = efgrid.getGridObject("ef_grid_result");
				 grid.refresh(eiInfo);*/
				var oper="insert";
				if(eiInfo.get("efCurButtonEname")=="UPDATE"){
					oper="update";
				}
				efgrid.submitForm("ef_grid_result", "ZM", "ZMCS05",oper, true);
			}
		},
		onFail:function(eMsg)
		{
			EFAlert("操作失败，原因："+eMsg); 
		}
}
efgrid_afterAddNewRow = function(grid_id){ 
	var fdMineId=$('#fdParentId').val();
	var fdParentType=$('#fdParentType').val();
	fdMineId=fdMineId.substring(0,fdMineId.indexOf("_"));
	var grid = efgrid.getGridObject(grid_id);
	var rows = grid.getCheckedRows();
	if(grid_id=="ef_grid_result")
	{
		for(var i = 0 ; i < rows.length;i++){
			grid.getBlockData().setCell(rows[i], "fdKeyId", "");
			grid.getBlockData().setCell(rows[i], "fdParentId", fdMineId);
			
//			grid.setCellValue(rows[i],0,fdMineId,TYPE_DATA);
		//	grid.setCellValue(rows[i],1,fdParentType,TYPE_DATA);
		}
	}
}